package view;


import model.Game;

import java.awt.Container;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.event.*;


public class GameGrill extends JFrame {
	
	private  int nbbutton=0;
	private JButton bSyllables[];
	private JPanel container;
	
	private Dimension dim=new Dimension(5,10);
	
	private Game game;
	
	public GameGrill(Game game) {
		 this.setSize(240, 260);
         this.setTitle("Mots coupés");
         this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
         this.setLocationRelativeTo(null);
         this.setResizable(false);
         Container contain=getContentPane();
         contain.add(container);
         
         this.game=game;
         nbbutton=game.getGameSyllables().size();
         bSyllables=new JButton[nbbutton];
         initComposant();
         
         
         this.setVisible(true);
	}
	
	public void initComposant() {
		
		String[] syllables=(String[])game.getGameSyllables().toArray();
		
		for(int i=0; i<syllables.length; i++) {
			bSyllables[i]=new JButton(syllables[i]);
			container.add(bSyllables[i]);
		}
	}
}
